package com.sfdk.pools
{
import com.sfdk.graphics.enums.ColorConstant;

import flash.text.TextFormat;
    import flash.text.TextFormatAlign;
    import flash.utils.Dictionary;

public class TextFormatPool
	{

		private static var instance_ : TextFormatPool;
		
		private var data_:Dictionary;
		
		public function TextFormatPool()
		{
			instance_ = this;
			data_ = new Dictionary();
			data_["Arial-12"] = new TextFormat("Arial", 12, 0, false, false, false);
            data_["SF-12"] = new TextFormat("Shining Force Regular", 32, 0xFFFFFF, false, false, false);
            data_["SF-12"].letterSpacing = -2;
            data_["SF-12"].leading = 4;

            data_["SFSys-12"] = new TextFormat("ShiningForceSys Regular", 16, 0xFFFFFF, false, false, false);
            data_["SFSys-12-Right"] = new TextFormat("ShiningForceSys Regular", 16, 0xFFFFFF, false, false, false);
            data_["SFSys-12-Right"].align = TextFormatAlign.RIGHT;

			data_["Arial-White-12"] = new TextFormat("Arial", 12, 0xFFFFFF, false, false, false);
			data_["Arial-White-20"] = new TextFormat("Arial", 20, 0xFFFFFF, false, false, false);
			data_["Arial-MarronFonce-11"] = new TextFormat("Arial", 11, 0x382D25, false, false, false);
			data_["Arial-MarronClair-12-Bold"] = new TextFormat("Arial", 13, ColorConstant.marronClair, true, false, false);
			
		}
		
		public static function get instance() : TextFormatPool
		{
			return instance_;
		}
		
		public function getTextFormat(name : String) : TextFormat
		{
			return data_[name] as TextFormat;
		}
		
		public function registerTextFormat(name : String, textFormat : TextFormat) : Boolean
		{
			if(data_[name] != null)
				return false;
			data_[name] = textFormat;
			return true;
		}

	}
}
